package com.cloud.usercenter.service.impl;

import com.cloud.commonapi.model.User_account;
import com.cloud.commonapi.model.User_info;
import com.cloud.usercenter.dao.User_accountMapper;
import com.cloud.usercenter.dao.User_infoMapper;
import com.cloud.usercenter.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

/**
 * @author 陈楚城
 * @date 2019/9/26 9:19
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private User_accountMapper userAccountMapper;
    @Autowired
    private User_infoMapper userInfoMapper;

    @Override
    public User_account getUser_accountbyId(Integer id) {
        return userAccountMapper.selectByPrimaryKey(id);
    }

    @Override
    public int add(User_account user_account) {

        return userAccountMapper.insert(user_account);
    }

    @Override
    public User_account getUser_accountbyAccount(String account) {
        return userAccountMapper.getUser_accountbyAccount(account);
    }

    @Override
    public User_info getUser_infobyAccountid(Integer accountid) {
        return userInfoMapper.getUser_infobyAccountid(accountid);
    }

    @Override
    public int updateUser_info(User_info user_info) {
        return userInfoMapper.updateByPrimaryKeySelective(user_info);
    }

    @Override
    public int addUser_info(User_info user_info) {
        return userInfoMapper.insertSelective(user_info);
    }

    @Override
    public int updatePassword(User_account user_account) {
        return userAccountMapper.updateByPrimaryKeySelective(user_account);
    }

    @Override
    public int updateByAccountIdSelective(User_info user_info) {
        return userInfoMapper.updateByAccountIdSelective(user_info);
    }
}
